
package com.sunwayhorizo.health.hl7.datatypes.common.gtsparser;

import com.sunwayhorizo.health.hl7.common.VersionInfo;
import com.sunwayhorizo.health.hl7.datatypes.BL;
import com.sunwayhorizo.health.hl7.datatypes.CS;
import com.sunwayhorizo.health.hl7.datatypes.EIVL;
import com.sunwayhorizo.health.hl7.datatypes.GTS;
import com.sunwayhorizo.health.hl7.datatypes.INT;
import com.sunwayhorizo.health.hl7.datatypes.IVL_PQ;
import com.sunwayhorizo.health.hl7.datatypes.IVL_TS;
import com.sunwayhorizo.health.hl7.datatypes.PIVL;
import com.sunwayhorizo.health.hl7.datatypes.PQ;
import com.sunwayhorizo.health.hl7.datatypes.REAL;
import com.sunwayhorizo.health.hl7.datatypes.SET_TS;
import com.sunwayhorizo.health.hl7.datatypes.TS;
import com.sunwayhorizo.health.hl7.datatypes.common.BLImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.CSImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.EIVLImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSCalendarPatternImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSDifferenceImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSHullImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSIntersectionImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSMinimalImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSSymbolHelper;
import com.sunwayhorizo.health.hl7.datatypes.common.GTSUnionImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.INTImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.IVL_PQImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.IVL_TSImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.NullFlavorImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.PIVL_TSImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.PQImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.REALImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.TSImpl;
import com.sunwayhorizo.health.hl7.datatypes.common.WidthIVL_TSImpl;

import java.io.InputStream;
import java.io.Reader;

import java.util.Enumeration;
import java.util.Vector;


// Referenced classes of package oracle.apps.ctb.hl7.types.common.gtsparser:
//            ParseException, SimpleCharStream, TimeParserConstants, TimeParserTokenManager, 
//            Token

public class TimeParser implements TimeParserConstants
{
    public static final String RCS_ID
	= "$Header: TimeParser.java 1.0 2006/05/13 15:04:55 atomlins noship $";
    public static final boolean RCS_ID_RECORDED
	= (VersionInfo.recordClassVersion
	   ("$Header: TimeParser.java 1.0 2006/05/13 15:04:55 atomlins noship $",
	    "com.sunwayhorizo.health.hl7.datatypes.common.gtsparser"));
    public TimeParserTokenManager token_source;
    SimpleCharStream jj_input_stream;
    public Token token;
    public Token jj_nt;
    private int jj_ntk;
    private Token jj_scanpos;
    private Token jj_lastpos;
    private int jj_la;
    public boolean lookingAhead = false;
    private boolean jj_semLA;
    private int jj_gen;
    private final int[] jj_la1;
    private static int[] jj_la1_0;
    private final JJCalls[] jj_2_rtns;
    private boolean jj_rescan;
    private int jj_gc;
    private final LookaheadSuccess jj_ls;
    private Vector jj_expentries;
    private int[] jj_expentry;
    private int jj_kind;
    private int[] jj_lasttokens;
    private int jj_endpos;
    
    private static final class LookaheadSuccess extends Error
    {
    }
    
    static final class JJCalls
    {
	int gen;
	Token first;
	int arg;
	JJCalls next;
    }
    
    public final GTS gts() throws ParseException {
	SET_TS set_ts = intersection();
	while (jj_2_1(2)) {
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 1:
		jj_consume_token(1);
		break;
	    default:
		jj_la1[0] = jj_gen;
	    }
	    set_ts = join(set_ts);
	}
	return (GTS) set_ts;
    }
    
    public final SET_TS join(SET_TS set_ts) throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 9: {
	    jj_consume_token(9);
	    if (jj_2_2(2))
		jj_consume_token(1);
	    SET_TS set_ts_0_ = intersection();
	    return GTSUnionImpl.valueOf((GTS) set_ts, (GTS) set_ts_0_);
	}
	case 10: {
	    jj_consume_token(10);
	    SET_TS set_ts_1_ = intersection();
	    return GTSDifferenceImpl.valueOf((GTS) set_ts, (GTS) set_ts_1_);
	}
	case 11: {
	    jj_consume_token(11);
	    SET_TS set_ts_2_ = intersection();
	    return GTSMinimalImpl.valueOf("");
	}
	default:
	    jj_la1[1] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final SET_TS intersection() throws ParseException {
	SET_TS set_ts = factor();
	while (jj_2_3(2)) {
	    jj_consume_token(1);
	    SET_TS set_ts_3_ = factor();
	    set_ts = GTSIntersectionImpl.valueOf((GTS) set_ts, (GTS) set_ts_3_);
	}
	return set_ts;
    }
    
    public final SET_TS factor() throws ParseException {
	if (jj_2_4(11)) {
	    PIVL pivl = pivl();
	    return pivl;
	}
	if (jj_2_5(4)) {
	    IVL_TS ivl_ts = ivl_ts();
	    return GTSHullImpl.valueOf(ivl_ts);
	}
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 2:
	case 3: {
	    TS ts = ts();
	    IVL_TS ivl_ts = IVL_TSImpl.valueOf(ts);
	    return GTSHullImpl.valueOf(ivl_ts);
	}
	case 24: {
	    EIVL eivl = eivl();
	    return eivl;
	}
	case 17: {
	    jj_consume_token(17);
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 1:
		jj_consume_token(1);
		break;
	    default:
		jj_la1[2] = jj_gen;
	    }
	    GTS gts = gts();
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 1:
		jj_consume_token(1);
		break;
	    default:
		jj_la1[3] = jj_gen;
	    }
	    jj_consume_token(18);
	    return gts;
	}
	case 25: {
	    GTS gts = symbol();
	    return gts;
	}
	default:
	    jj_la1[4] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final TS ts() throws ParseException {
	String string = null;
	String string_4_ = qty();
	if (jj_2_6(2)) {
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 1:
		jj_consume_token(1);
		break;
	    default:
		jj_la1[5] = jj_gen;
	    }
	    string = tz();
	}
	return TSImpl.valueOf(string_4_, string);
    }
    
    public final IVL_TS ivl_ts() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 12:
	case 13:
	case 14:
	case 15: {
	    IVL_TS ivl_ts = comparator();
	    return ivl_ts;
	}
	default:
	    jj_la1[6] = jj_gen;
	    if (jj_2_7(4)) {
		IVL_TS ivl_ts = hull();
		return ivl_ts;
	    }
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 2:
	    case 3: {
		IVL_TS ivl_ts = center_width();
		return ivl_ts;
	    }
	    default:
		jj_la1[7] = jj_gen;
		if (jj_2_8(6)) {
		    IVL_TS ivl_ts = interval();
		    return ivl_ts;
		}
		if (jj_2_9(4)) {
		    IVL_TS ivl_ts = width();
		    return ivl_ts;
		}
		switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
		case 7:
		case 8: {
		    IVL_TS ivl_ts = low();
		    return ivl_ts;
		}
		default:
		    jj_la1[8] = jj_gen;
		    jj_consume_token(-1);
		    throw new ParseException();
		}
	    }
	}
    }
    
    public final PIVL pivl() throws ParseException {
	IVL_TS ivl_ts = IVL_TSImpl.nullIVL_TS(NullFlavorImpl.NI);
	CS cs = CSImpl.nullCS(NullFlavorImpl.NI);
	String string = null;
	String string_5_ = null;
	INT var_int = INTImpl.nullINT(NullFlavorImpl.NI);
	String string_6_ = null;
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 2:
	case 3:
	case 7:
	case 8:
	case 12:
	case 13:
	case 14:
	case 15:
	case 16: {
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 2:
	    case 3:
	    case 7:
	    case 8:
	    case 12:
	    case 13:
	    case 14:
	    case 15:
		ivl_ts = ivl_ts();
		break;
	    default:
		jj_la1[9] = jj_gen;
	    }
	    jj_consume_token(16);
	    jj_consume_token(17);
	    PQ pq = pq();
	    jj_consume_token(18);
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 19:
		cs = align();
		break;
	    default:
		jj_la1[10] = jj_gen;
	    }
	    if (jj_2_10(2))
		string_6_ = ist();
	    if (string_6_ == null)
		return PIVL_TSImpl.valueOf(ivl_ts, pq, cs, BLImpl.FALSE);
	    return PIVL_TSImpl.valueOf(ivl_ts, pq, cs, BLImpl.TRUE);
	}
	case 22:
	    cs = cycle();
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 2:
		string = digits();
		switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
		case 11:
		    string_5_ = highDigits();
		    break;
		default:
		    jj_la1[11] = jj_gen;
		}
		break;
	    default:
		jj_la1[12] = jj_gen;
	    }
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 16:
		var_int = period();
		break;
	    default:
		jj_la1[13] = jj_gen;
	    }
	    if (jj_2_11(2))
		string_6_ = ist();
	    if (string_6_ == null)
		return GTSCalendarPatternImpl.valueOf(cs, string, string_5_,
						      var_int,BLImpl.FALSE);
	    return GTSCalendarPatternImpl.valueOf(cs, string, string_5_,
						  var_int,BLImpl.TRUE);
	default:
	    jj_la1[14] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final EIVL eivl() throws ParseException {
	IVL_PQ ivl_pq = IVL_PQImpl.nullIVL_PQ(NullFlavorImpl.NI);
	CS cs = timingEvent();
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 4:
	case 5:
	    ivl_pq = offset();
	    break;
	default:
	    jj_la1[15] = jj_gen;
	}
	return EIVLImpl.valueOf(cs, ivl_pq);
    }
    
    public final String qty() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 2: {
	    Token token = jj_consume_token(2);
	    return token.image;
	}
	case 3: {
	    Token token = jj_consume_token(3);
	    return token.image;
	}
	default:
	    jj_la1[16] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final String tz() throws ParseException {
	Token token = jj_consume_token(6);
	return token.image;
    }
    
    public final IVL_TS interval() throws ParseException {
	if (jj_2_12(2)) {
	    BL bl = open();
	    TS ts = ts();
	    jj_consume_token(9);
	    TS ts_7_ = ts();
	    BL bl_8_ = close();
	    return IVL_TSImpl.valueOf(ts, bl, ts_7_, bl_8_);
	}
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 7:
	case 8: {
	    BL bl = open();
	    jj_consume_token(9);
	    TS ts = ts();
	    BL bl_9_ = close();
	    TS ts_10_ = TSImpl.nullTS(NullFlavorImpl.NINF);
	    return IVL_TSImpl.valueOf(ts_10_, bl, ts, bl_9_);
	}
	default:
	    jj_la1[17] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final IVL_TS low() throws ParseException {
	BL bl = open();
	TS ts = ts();
	if (jj_2_13(3)) {
	    jj_consume_token(9);
	    switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	    case 7:
	    case 8: {
		BL bl_11_ = close();
		break;
	    }
	    default:
		jj_la1[18] = jj_gen;
	    }
	}
	TS ts_12_ = TSImpl.nullTS(NullFlavorImpl.PINF);
	BL bl_13_ = BLImpl.nullBL(NullFlavorImpl.NA);
	return IVL_TSImpl.valueOf(ts, bl, ts_12_, bl_13_);
    }
    
    public final IVL_TS comparator() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 12: {
	    jj_consume_token(12);
	    TS ts = ts();
	    BLImpl blimpl = BLImpl.FALSE;
	    TS ts_14_ = TSImpl.nullTS(NullFlavorImpl.NINF);
	    BL bl = BLImpl.nullBL(NullFlavorImpl.NA);
	    return IVL_TSImpl.valueOf(ts_14_, bl, ts, blimpl);
	}
	case 13: {
	    jj_consume_token(13);
	    TS ts = ts();
	    BLImpl blimpl = BLImpl.FALSE;
	    TS ts_15_ = TSImpl.nullTS(NullFlavorImpl.PINF);
	    BL bl = BLImpl.nullBL(NullFlavorImpl.NA);
	    return IVL_TSImpl.valueOf(ts, blimpl, ts_15_, bl);
	}
	case 14: {
	    jj_consume_token(14);
	    TS ts = ts();
	    BLImpl blimpl = BLImpl.TRUE;
	    TS ts_16_ = TSImpl.nullTS(NullFlavorImpl.NINF);
	    BL bl = BLImpl.nullBL(NullFlavorImpl.NA);
	    return IVL_TSImpl.valueOf(ts_16_, bl, ts, blimpl);
	}
	case 15: {
	    jj_consume_token(15);
	    TS ts = ts();
	    BLImpl blimpl = BLImpl.TRUE;
	    TS ts_17_ = TSImpl.nullTS(NullFlavorImpl.PINF);
	    BL bl = BLImpl.nullBL(NullFlavorImpl.NA);
	    return IVL_TSImpl.valueOf(ts, blimpl, ts_17_, bl);
	}
	default:
	    jj_la1[19] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final IVL_TS hull() throws ParseException {
	TS ts = ts();
	jj_consume_token(11);
	String string = qty();
	return IVL_TSImpl.valueOf(ts, string);
    }
    
    public final IVL_TS center_width() throws ParseException {
	if (jj_2_14(5)) {
	    TS ts = ts();
	    IVL_TS ivl_ts = width();
	    return WidthIVL_TSImpl.valueOf(ts, ivl_ts);
	}
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 2:
	case 3: {
	    TS ts = ts();
	    BL bl = close();
	    TS ts_18_ = TSImpl.nullTS(NullFlavorImpl.NINF);
	    BL bl_19_ = BLImpl.nullBL(NullFlavorImpl.NA);
	    return IVL_TSImpl.valueOf(ts_18_, bl_19_, ts, bl);
	}
	default:
	    jj_la1[20] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final IVL_TS width() throws ParseException {
	BL bl = open();
	PQ pq = pq();
	BL bl_20_ = close();
	return WidthIVL_TSImpl.valueOf(bl, pq, bl_20_);
    }
    
    public final BL open() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 7: {
	    Token token = jj_consume_token(7);
	    return BLImpl.TRUE;
	}
	case 8: {
	    Token token = jj_consume_token(8);
	    return BLImpl.FALSE;
	}
	default:
	    jj_la1[21] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final BL close() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 8: {
	    Token token = jj_consume_token(8);
	    return BLImpl.TRUE;
	}
	case 7: {
	    Token token = jj_consume_token(7);
	    return BLImpl.FALSE;
	}
	default:
	    jj_la1[22] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final PQ pq() throws ParseException {
	String string = qty();
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 1:
	    jj_consume_token(1);
	    break;
	default:
	    jj_la1[23] = jj_gen;
	}
	String string_21_ = uom();
	return PQImpl.valueOf(string, string_21_);
    }
    
    public final String uom() throws ParseException {
	Token token = jj_consume_token(20);
	return token.image;
    }
    
    public final CS align() throws ParseException {
	jj_consume_token(19);
	Token token = jj_consume_token(21);
	return CSImpl.valueOf(token.image);
    }
    
    public final CS cycle() throws ParseException {
	Token token = jj_consume_token(22);
	return CSImpl.valueOf(token.image);
    }
    
    public final String digits() throws ParseException {
	Token token = jj_consume_token(2);
	return token.image;
    }
    
    public final String highDigits() throws ParseException {
	jj_consume_token(11);
	String string = digits();
	return string;
    }
    
    public final INT period() throws ParseException {
	jj_consume_token(16);
	Token token = jj_consume_token(2);
	return INTImpl.valueOf(Long.parseLong(token.image));
    }
    
    public final String ist() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 1:
	    jj_consume_token(1);
	    break;
	default:
	    jj_la1[24] = jj_gen;
	}
	Token token = jj_consume_token(23);
	return token.image;
    }
    
    public final CS timingEvent() throws ParseException {
	Token token = jj_consume_token(24);
	return CSImpl.valueOf(token.image);
    }
    
    public final IVL_PQ offset() throws ParseException {
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 4: {
	    jj_consume_token(4);
	    IVL_PQ ivl_pq = ivl_pq();
	    return ivl_pq;
	}
	case 5: {
	    jj_consume_token(5);
	    IVL_PQ ivl_pq = ivl_pq();
	    REAL real = REALImpl.valueOf("-1");
	    PQ pq = ivl_pq.low().times(real);
	    PQ pq_22_ = ivl_pq.high().times(real);
	    BL bl = ivl_pq.highClosed();
	    BL bl_23_ = ivl_pq.lowClosed();
	    return IVL_PQImpl.valueOf(pq, bl, pq_22_, bl_23_);
	}
	default:
	    jj_la1[25] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final IVL_PQ ivl_pq() throws ParseException {
	if (jj_2_15(3)) {
	    IVL_PQ ivl_pq = generic();
	    return ivl_pq;
	}
	switch (jj_ntk == -1 ? jj_ntk() : jj_ntk) {
	case 7:
	case 8: {
	    IVL_PQ ivl_pq = shorthand();
	    return ivl_pq;
	}
	default:
	    jj_la1[26] = jj_gen;
	    jj_consume_token(-1);
	    throw new ParseException();
	}
    }
    
    public final IVL_PQ generic() throws ParseException {
	BL bl = open();
	PQ pq = pq();
	jj_consume_token(9);
	PQ pq_24_ = pq();
	BL bl_25_ = close();
	return IVL_PQImpl.valueOf(pq, bl, pq_24_, bl_25_);
    }
    
    public final IVL_PQ shorthand() throws ParseException {
	BL bl = open();
	String string = qty();
	jj_consume_token(9);
	String string_26_ = qty();
	BL bl_27_ = close();
	String string_28_ = uom();
	REAL real = REALImpl.valueOf(string);
	REAL real_29_ = REALImpl.valueOf(string_26_);
	CS cs = CSImpl.valueOf(string_28_);
	return IVL_PQImpl.valueOf(real, bl, real_29_, bl_27_, cs);
    }
    
    public final GTS symbol() throws ParseException {
	Token token = jj_consume_token(25);
	return GTSSymbolHelper.valueOf(token.image);
    }
    
    private final boolean jj_2_1(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_1();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(0, i);
	}
    }
    
    private final boolean jj_2_2(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_2();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(1, i);
	}
    }
    
    private final boolean jj_2_3(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_3();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(2, i);
	}
    }
    
    private final boolean jj_2_4(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_4();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(3, i);
	}
    }
    
    private final boolean jj_2_5(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_5();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(4, i);
	}
    }
    
    private final boolean jj_2_6(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_6();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(5, i);
	}
    }
    
    private final boolean jj_2_7(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_7();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(6, i);
	}
    }
    
    private final boolean jj_2_8(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_8();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(7, i);
	}
    }
    
    private final boolean jj_2_9(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_9();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(8, i);
	}
    }
    
    private final boolean jj_2_10(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_10();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(9, i);
	}
    }
    
    private final boolean jj_2_11(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_11();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(10, i);
	}
    }
    
    private final boolean jj_2_12(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_12();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(11, i);
	}
    }
    
    private final boolean jj_2_13(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_13();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(12, i);
	}
    }
    
    private final boolean jj_2_14(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_14();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(13, i);
	}
    }
    
    private final boolean jj_2_15(int i) {
	jj_la = i;
	jj_lastpos = jj_scanpos = token;
	try {
	    return !jj_3_15();
	} catch (LookaheadSuccess lookaheadsuccess) {
	    return true;
	} finally {
	    jj_save(14, i);
	}
    }
    
    private final boolean jj_3R_19() {
	if (jj_3R_13())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_56() {
	if (jj_scan_token(13))
	    return true;
	if (jj_3R_13())
	    return true;
	return false;
    }
    
    private final boolean jj_3_5() {
	if (jj_3R_6())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_11() {
	Token token = jj_scanpos;
	if (jj_scan_token(1))
	    jj_scanpos = token;
	if (jj_scan_token(23))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_42() {
	Token token = jj_scanpos;
	if (jj_3R_55()) {
	    jj_scanpos = token;
	    if (jj_3R_56()) {
		jj_scanpos = token;
		if (jj_3R_57()) {
		    jj_scanpos = token;
		    if (jj_3R_58())
			return true;
		}
	    }
	}
	return false;
    }
    
    private final boolean jj_3R_55() {
	if (jj_scan_token(12))
	    return true;
	if (jj_3R_13())
	    return true;
	return false;
    }
    
    private final boolean jj_3_4() {
	if (jj_3R_5())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_4() {
	Token token = jj_scanpos;
	if (jj_3_4()) {
	    jj_scanpos = token;
	    if (jj_3_5()) {
		jj_scanpos = token;
		if (jj_3R_19()) {
		    jj_scanpos = token;
		    if (jj_3R_20()) {
			jj_scanpos = token;
			if (jj_3R_21()) {
			    jj_scanpos = token;
			    if (jj_3R_22())
				return true;
			}
		    }
		}
	    }
	}
	return false;
    }
    
    private final boolean jj_3_3() {
	if (jj_scan_token(1))
	    return true;
	if (jj_3R_4())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_54() {
	if (jj_scan_token(16))
	    return true;
	if (jj_scan_token(2))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_44() {
	if (jj_3R_12())
	    return true;
	if (jj_3R_13())
	    return true;
	Token token = jj_scanpos;
	if (jj_3_13())
	    jj_scanpos = token;
	return false;
    }
    
    private final boolean jj_3R_60() {
	if (jj_scan_token(11))
	    return true;
	if (jj_3R_52())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_34() {
	if (jj_3R_4())
	    return true;
	return false;
    }
    
    private final boolean jj_3_11() {
	if (jj_3R_11())
	    return true;
	return false;
    }
    
    private final boolean jj_3_10() {
	if (jj_3R_11())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_29() {
	if (jj_3R_12())
	    return true;
	if (jj_scan_token(9))
	    return true;
	if (jj_3R_13())
	    return true;
	if (jj_3R_31())
	    return true;
	return false;
    }
    
    private final boolean jj_3_1() {
	Token token = jj_scanpos;
	if (jj_scan_token(1))
	    jj_scanpos = token;
	if (jj_3R_3())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_52() {
	if (jj_scan_token(2))
	    return true;
	return false;
    }
    
    private final boolean jj_3_2() {
	if (jj_scan_token(1))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_18() {
	if (jj_scan_token(11))
	    return true;
	if (jj_3R_34())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_9() {
	Token token = jj_scanpos;
	if (jj_3_12()) {
	    jj_scanpos = token;
	    if (jj_3R_29())
		return true;
	}
	return false;
    }
    
    private final boolean jj_3_12() {
	if (jj_3R_12())
	    return true;
	if (jj_3R_13())
	    return true;
	if (jj_scan_token(9))
	    return true;
	if (jj_3R_13())
	    return true;
	if (jj_3R_31())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_17() {
	if (jj_scan_token(10))
	    return true;
	if (jj_3R_34())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_16() {
	if (jj_scan_token(9))
	    return true;
	Token token = jj_scanpos;
	if (jj_3_2())
	    jj_scanpos = token;
	if (jj_3R_34())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_3() {
	Token token = jj_scanpos;
	if (jj_3R_16()) {
	    jj_scanpos = token;
	    if (jj_3R_17()) {
		jj_scanpos = token;
		if (jj_3R_18())
		    return true;
	    }
	}
	return false;
    }
    
    private final boolean jj_3R_39() {
	if (jj_scan_token(22))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_41() {
	if (jj_3R_54())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_38() {
	if (jj_3R_51())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_7() {
	if (jj_scan_token(6))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_51() {
	if (jj_scan_token(19))
	    return true;
	if (jj_scan_token(21))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_46() {
	if (jj_scan_token(3))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_28() {
	Token token = jj_scanpos;
	if (jj_3R_45()) {
	    jj_scanpos = token;
	    if (jj_3R_46())
		return true;
	}
	return false;
    }
    
    private final boolean jj_3R_45() {
	if (jj_scan_token(2))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_53() {
	if (jj_3R_60())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_47() {
	if (jj_scan_token(20))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_35() {
	if (jj_3R_50())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_30() {
	if (jj_3R_28())
	    return true;
	Token token = jj_scanpos;
	if (jj_scan_token(1))
	    jj_scanpos = token;
	if (jj_3R_47())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_40() {
	if (jj_3R_52())
	    return true;
	Token token = jj_scanpos;
	if (jj_3R_53())
	    jj_scanpos = token;
	return false;
    }
    
    private final boolean jj_3R_49() {
	if (jj_scan_token(7))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_36() {
	if (jj_scan_token(25))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_31() {
	Token token = jj_scanpos;
	if (jj_3R_48()) {
	    jj_scanpos = token;
	    if (jj_3R_49())
		return true;
	}
	return false;
    }
    
    private final boolean jj_3R_48() {
	if (jj_scan_token(8))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_24() {
	if (jj_3R_39())
	    return true;
	Token token = jj_scanpos;
	if (jj_3R_40())
	    jj_scanpos = token;
	token = jj_scanpos;
	if (jj_3R_41())
	    jj_scanpos = token;
	token = jj_scanpos;
	if (jj_3_11())
	    jj_scanpos = token;
	return false;
    }
    
    private final boolean jj_3R_33() {
	if (jj_scan_token(8))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_37() {
	if (jj_3R_6())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_5() {
	Token token = jj_scanpos;
	if (jj_3R_23()) {
	    jj_scanpos = token;
	    if (jj_3R_24())
		return true;
	}
	return false;
    }
    
    private final boolean jj_3R_23() {
	Token token = jj_scanpos;
	if (jj_3R_37())
	    jj_scanpos = token;
	if (jj_scan_token(16))
	    return true;
	if (jj_scan_token(17))
	    return true;
	if (jj_3R_30())
	    return true;
	if (jj_scan_token(18))
	    return true;
	token = jj_scanpos;
	if (jj_3R_38())
	    jj_scanpos = token;
	token = jj_scanpos;
	if (jj_3_10())
	    jj_scanpos = token;
	return false;
    }
    
    private final boolean jj_3R_12() {
	Token token = jj_scanpos;
	if (jj_3R_32()) {
	    jj_scanpos = token;
	    if (jj_3R_33())
		return true;
	}
	return false;
    }
    
    private final boolean jj_3R_32() {
	if (jj_scan_token(7))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_10() {
	if (jj_3R_12())
	    return true;
	if (jj_3R_30())
	    return true;
	if (jj_3R_31())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_27() {
	if (jj_3R_44())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_15() {
	if (jj_3R_12())
	    return true;
	if (jj_3R_30())
	    return true;
	return false;
    }
    
    private final boolean jj_3_9() {
	if (jj_3R_10())
	    return true;
	return false;
    }
    
    private final boolean jj_3_8() {
	if (jj_3R_9())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_59() {
	if (jj_3R_13())
	    return true;
	if (jj_3R_31())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_26() {
	if (jj_3R_43())
	    return true;
	return false;
    }
    
    private final boolean jj_3_14() {
	if (jj_3R_13())
	    return true;
	if (jj_3R_10())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_43() {
	Token token = jj_scanpos;
	if (jj_3_14()) {
	    jj_scanpos = token;
	    if (jj_3R_59())
		return true;
	}
	return false;
    }
    
    private final boolean jj_3_7() {
	if (jj_3R_8())
	    return true;
	return false;
    }
    
    private final boolean jj_3_15() {
	if (jj_3R_15())
	    return true;
	return false;
    }
    
    private final boolean jj_3_6() {
	Token token = jj_scanpos;
	if (jj_scan_token(1))
	    jj_scanpos = token;
	if (jj_3R_7())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_6() {
	Token token = jj_scanpos;
	if (jj_3R_25()) {
	    jj_scanpos = token;
	    if (jj_3_7()) {
		jj_scanpos = token;
		if (jj_3R_26()) {
		    jj_scanpos = token;
		    if (jj_3_8()) {
			jj_scanpos = token;
			if (jj_3_9()) {
			    jj_scanpos = token;
			    if (jj_3R_27())
				return true;
			}
		    }
		}
	    }
	}
	return false;
    }
    
    private final boolean jj_3R_25() {
	if (jj_3R_42())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_8() {
	if (jj_3R_13())
	    return true;
	if (jj_scan_token(11))
	    return true;
	if (jj_3R_28())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_13() {
	if (jj_3R_28())
	    return true;
	Token token = jj_scanpos;
	if (jj_3_6())
	    jj_scanpos = token;
	return false;
    }
    
    private final boolean jj_3R_14() {
	if (jj_3R_31())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_22() {
	if (jj_3R_36())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_58() {
	if (jj_scan_token(15))
	    return true;
	if (jj_3R_13())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_21() {
	if (jj_scan_token(17))
	    return true;
	return false;
    }
    
    private final boolean jj_3R_57() {
	if (jj_scan_token(14))
	    return true;
	if (jj_3R_13())
	    return true;
	return false;
    }
    
    private final boolean jj_3R_20() {
	if (jj_3R_35())
	    return true;
	return false;
    }
    
    private final boolean jj_3_13() {
	if (jj_scan_token(9))
	    return true;
	Token token = jj_scanpos;
	if (jj_3R_14())
	    jj_scanpos = token;
	return false;
    }
    
    private final boolean jj_3R_50() {
	if (jj_scan_token(24))
	    return true;
	return false;
    }
    
    private static void jj_la1_0() {
	jj_la1_0 = new int[] { 2, 3584, 2, 2, 50462732, 2, 61440, 12, 384,
			       61836, 524288, 2048, 4, 65536, 4321676, 48, 12,
			       384, 384, 61440, 12, 384, 384, 2, 2, 48, 384 };
    }
    
    public TimeParser(InputStream inputstream) {
	jj_la1 = new int[27];
	jj_2_rtns = new JJCalls[15];
	jj_rescan = false;
	jj_ls = new LookaheadSuccess();
	jj_expentries = new Vector();
	jj_kind = -1;
	jj_lasttokens = new int[100];
	jj_input_stream = new SimpleCharStream(inputstream, 1, 1);
	token_source = new TimeParserTokenManager(jj_input_stream);
	token = new Token();
	jj_ntk = -1;
	jj_gen = 0;
	for (int i = 0; i < 27; i++)
	    jj_la1[i] = -1;
	for (int i = 0; i < jj_2_rtns.length; i++)
	    jj_2_rtns[i] = new JJCalls();
    }
    
    public void ReInit(InputStream inputstream) {
	jj_input_stream.ReInit(inputstream, 1, 1);
	token_source.ReInit(jj_input_stream);
	token = new Token();
	jj_ntk = -1;
	jj_gen = 0;
	for (int i = 0; i < 27; i++)
	    jj_la1[i] = -1;
	for (int i = 0; i < jj_2_rtns.length; i++)
	    jj_2_rtns[i] = new JJCalls();
    }
    
    public TimeParser(Reader reader) {
	jj_la1 = new int[27];
	jj_2_rtns = new JJCalls[15];
	jj_rescan = false;
	jj_ls = new LookaheadSuccess();
	jj_expentries = new Vector();
	jj_kind = -1;
	jj_lasttokens = new int[100];
	jj_input_stream = new SimpleCharStream(reader, 1, 1);
	token_source = new TimeParserTokenManager(jj_input_stream);
	token = new Token();
	jj_ntk = -1;
	jj_gen = 0;
	for (int i = 0; i < 27; i++)
	    jj_la1[i] = -1;
	for (int i = 0; i < jj_2_rtns.length; i++)
	    jj_2_rtns[i] = new JJCalls();
    }
    
    public void ReInit(Reader reader) {
	jj_input_stream.ReInit(reader, 1, 1);
	token_source.ReInit(jj_input_stream);
	token = new Token();
	jj_ntk = -1;
	jj_gen = 0;
	for (int i = 0; i < 27; i++)
	    jj_la1[i] = -1;
	for (int i = 0; i < jj_2_rtns.length; i++)
	    jj_2_rtns[i] = new JJCalls();
    }
    
    public TimeParser(TimeParserTokenManager timeparsertokenmanager) {
	jj_la1 = new int[27];
	jj_2_rtns = new JJCalls[15];
	jj_rescan = false;
	jj_ls = new LookaheadSuccess();
	jj_expentries = new Vector();
	jj_kind = -1;
	jj_lasttokens = new int[100];
	token_source = timeparsertokenmanager;
	token = new Token();
	jj_ntk = -1;
	jj_gen = 0;
	for (int i = 0; i < 27; i++)
	    jj_la1[i] = -1;
	for (int i = 0; i < jj_2_rtns.length; i++)
	    jj_2_rtns[i] = new JJCalls();
    }
    
    public void ReInit(TimeParserTokenManager timeparsertokenmanager) {
	token_source = timeparsertokenmanager;
	token = new Token();
	jj_ntk = -1;
	jj_gen = 0;
	for (int i = 0; i < 27; i++)
	    jj_la1[i] = -1;
	for (int i = 0; i < jj_2_rtns.length; i++)
	    jj_2_rtns[i] = new JJCalls();
    }
    
    private final Token jj_consume_token(int i) throws ParseException {
	Token token;
	if ((token = this.token).next != null)
	    this.token = this.token.next;
	else
	    this.token = this.token.next = token_source.getNextToken();
	jj_ntk = -1;
	if (this.token.kind == i) {
	    jj_gen++;
	    if (++jj_gc > 100) {
		jj_gc = 0;
		for (int i_30_ = 0; i_30_ < jj_2_rtns.length; i_30_++) {
		    for (JJCalls jjcalls = jj_2_rtns[i_30_]; jjcalls != null;
			 jjcalls = jjcalls.next) {
			if (jjcalls.gen < jj_gen)
			    jjcalls.first = null;
		    }
		}
	    }
	    return this.token;
	}
	this.token = token;
	jj_kind = i;
	throw generateParseException();
    }
    
    private final boolean jj_scan_token(int i) {
	if (jj_scanpos == jj_lastpos) {
	    jj_la--;
	    if (jj_scanpos.next == null)
		jj_lastpos = jj_scanpos = jj_scanpos.next
		    = token_source.getNextToken();
	    else
		jj_lastpos = jj_scanpos = jj_scanpos.next;
	} else
	    jj_scanpos = jj_scanpos.next;
	if (jj_rescan) {
	    int i_31_ = 0;
	    Token token;
	    for (token = this.token; token != null && token != jj_scanpos;
		 token = token.next)
		i_31_++;
	    if (token != null)
		jj_add_error_token(i, i_31_);
	}
	if (jj_scanpos.kind != i)
	    return true;
	if (jj_la == 0 && jj_scanpos == jj_lastpos)
	    throw jj_ls;
	return false;
    }
    
    public final Token getNextToken() {
	if (token.next != null)
	    token = token.next;
	else
	    token = token.next = token_source.getNextToken();
	jj_ntk = -1;
	jj_gen++;
	return token;
    }
    
    public final Token getToken(int i) {
	Token token = lookingAhead ? jj_scanpos : this.token;
	for (int i_32_ = 0; i_32_ < i; i_32_++) {
	    if (token.next != null)
		token = token.next;
	    else
		token = token.next = token_source.getNextToken();
	}
	return token;
    }
    
    private final int jj_ntk() {
	if ((jj_nt = token.next) == null)
	    return jj_ntk = (token.next = token_source.getNextToken()).kind;
	return jj_ntk = jj_nt.kind;
    }
    
    private void jj_add_error_token(int i, int i_33_) {
	if (i_33_ < 100) {
	    if (i_33_ == jj_endpos + 1)
		jj_lasttokens[jj_endpos++] = i;
	    else if (jj_endpos != 0) {
		jj_expentry = new int[jj_endpos];
		for (int i_34_ = 0; i_34_ < jj_endpos; i_34_++)
		    jj_expentry[i_34_] = jj_lasttokens[i_34_];
		boolean bool = false;
		Enumeration enumeration = jj_expentries.elements();
		while (enumeration.hasMoreElements()) {
		    int[] is = (int[]) enumeration.nextElement();
		    if (is.length == jj_expentry.length) {
			bool = true;
			for (int i_35_ = 0; i_35_ < jj_expentry.length;
			     i_35_++) {
			    if (is[i_35_] != jj_expentry[i_35_]) {
				bool = false;
				break;
			    }
			}
			if (bool)
			    break;
		    }
		}
		if (!bool)
		    jj_expentries.addElement(jj_expentry);
		if (i_33_ != 0)
		    jj_lasttokens[(jj_endpos = i_33_) - 1] = i;
	    }
	}
    }
    
    public ParseException generateParseException() {
	jj_expentries.removeAllElements();
	boolean[] bools = new boolean[27];
	for (int i = 0; i < 27; i++)
	    bools[i] = false;
	if (jj_kind >= 0) {
	    bools[jj_kind] = true;
	    jj_kind = -1;
	}
	for (int i = 0; i < 27; i++) {
	    if (jj_la1[i] == jj_gen) {
		for (int i_36_ = 0; i_36_ < 32; i_36_++) {
		    if ((jj_la1_0[i] & 1 << i_36_) != 0)
			bools[i_36_] = true;
		}
	    }
	}
	for (int i = 0; i < 27; i++) {
	    if (bools[i]) {
		jj_expentry = new int[1];
		jj_expentry[0] = i;
		jj_expentries.addElement(jj_expentry);
	    }
	}
	jj_endpos = 0;
	jj_rescan_token();
	jj_add_error_token(0, 0);
	int[][] is = new int[jj_expentries.size()][];
	for (int i = 0; i < jj_expentries.size(); i++)
	    is[i] = (int[]) jj_expentries.elementAt(i);
	return new ParseException(token, is, TimeParserConstants.tokenImage);
    }
    
    public final void enable_tracing() {
	/* empty */
    }
    
    public final void disable_tracing() {
	/* empty */
    }
    
    private final void jj_rescan_token() {
	jj_rescan = true;
	int i = 0;
	while (i < 15) {
	    JJCalls jjcalls = jj_2_rtns[i];
	    for (;;) {
		if (jjcalls.gen > jj_gen) {
		    jj_la = jjcalls.arg;
		    jj_lastpos = jj_scanpos = jjcalls.first;
		    switch (i) {
		    case 0:
			jj_3_1();
			break;
		    case 1:
			jj_3_2();
			break;
		    case 2:
			jj_3_3();
			break;
		    case 3:
			jj_3_4();
			break;
		    case 4:
			jj_3_5();
			break;
		    case 5:
			jj_3_6();
			break;
		    case 6:
			jj_3_7();
			break;
		    case 7:
			jj_3_8();
			break;
		    case 8:
			jj_3_9();
			break;
		    case 9:
			jj_3_10();
			break;
		    case 10:
			jj_3_11();
			break;
		    case 11:
			jj_3_12();
			break;
		    case 12:
			jj_3_13();
			break;
		    case 13:
			jj_3_14();
			break;
		    case 14:
			jj_3_15();
			break;
		    }
		}
		jjcalls = jjcalls.next;
		if (jjcalls == null) {
		    i++;
		    break;
		}
	    }
	}
	jj_rescan = false;
    }
    
    private final void jj_save(int i, int i_37_) {
	JJCalls jjcalls;
	for (jjcalls = jj_2_rtns[i]; jjcalls.gen > jj_gen;
	     jjcalls = jjcalls.next) {
	    if (jjcalls.next == null) {
		jjcalls = jjcalls.next = new JJCalls();
		break;
	    }
	}
	jjcalls.gen = jj_gen + i_37_ - jj_la;
	jjcalls.first = token;
	jjcalls.arg = i_37_;
    }
    
    static {
	jj_la1_0();
    }
}
